<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreatePostsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('posts', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('category_id')->unsigned()->nullable()->index('posts_category_id_foreign')->comment('类别');
			$table->string('title', 100)->comment('标题');
			$table->string('slug', 50)->comment('锚点');
			$table->string('summary', 140)->comment('概要');
			$table->string('thumb')->comment('缩略图');
			$table->text('content', 65535)->comment('内容');
			$table->integer('comment_count')->unsigned()->comment('评论次数');
			$table->integer('view_count')->unsigned()->comment('浏览次数');
			$table->integer('favorite_count')->unsigned()->comment('点赞次数');
			$table->boolean('published')->comment('文章是否发布');
			$table->dateTime('published_at')->comment('文章发布时间');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('posts');
	}

}
